home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- * *
- * Smaller Installerâ„¢ *
- * *
- * © 1992 Bill Goodman *
- * All Rights Reserved *
- * *
- *******************************************************************************
-
- Quickdraw Hook Example
-
- This installer hook procedure checks that the target machine is running System
- 6.0.5 or higher. It also installs the 32-bit Quickdraw file if the target
- machine is not running version 1.2 or higher. The hook procedure installs the
- Quickdraw file by enabling installation group "P" so the installer will install
- the 32-bit Quickdraw file in the system folder.
-
- To use this hook procedure, you must compile this code and create a code
- resource with type 'SICR' and an ID of 500. This resource should be
- non-preloaded, nonpurgeable, unlocked, unprotected and non-sysheap. Copy this
- resource and the ALRT/DITL resources from the "QD32Hook.ALRT.rsrc" file to your
- installer's resource file. Add the 32-bit Quickdraw file to your source archive
- using the following path: "{P}:$SYSTEM:32-Bit QuickDraw"
-
- ******************************************************************************/
-
- #include <SetUpA4.h>
- #include <GestaltEqu.h>
- #include "SIHookProc.h"
-
-
- /******************************************************************************
- Module Internal Function Prototypes
- ******************************************************************************/
- void SetTargetVolFunction(void);
- void BeginInstallFunction(void);
-
-
- /******************************************************************************
- Constant Declarations
- ******************************************************************************/
- #define groupPMask 0x8000 /* Group "P" selection mask */
-
- /* Alert Definitions */
- #define sysRequiredAlrt 500 /* "Meteor requires version 6.0.5 or newer of the system software." */
-
-
- /******************************************************************************
- Module Variables Declarations
- ******************************************************************************/
- SIHookParmBlk *parms; /* Global pointer to parameter block */
- Boolean gestaltFailed = false; /* Set if Gestalt could not return result */
- unsigned char emptyPStr[] = "\p"; /* Empty Pascal string */
-
-
- /*****************************************************************************/
- pascal void main(
- SIHookParmBlk *parmBlk /* Pointer to parameter block */
- )
- /******************************************************************************
- This is the main entry point for the installer hook procedure.
- ******************************************************************************/
- {
- RememberA0(); /* This is necessary to access any global variables */
- SetUpA4();
- parms = parmBlk;
-
- switch (parms->function)
- {
- case siHookSetTargetVol:
- SetTargetVolFunction();
- break;
-
- case siHookBeginInstall:
- BeginInstallFunction();
- break;
- }
- RestoreA4();
- }
-
-
- /*****************************************************************************/
- void SetTargetVolFunction(void)
- /******************************************************************************
- Input parameters:
- "targetVRefNum" - Volume reference number of target volume
- "groupAPFlags", "groupQUSel", "groupVZSel" - Groups currently selected
- for installation
- Returns:
- "groupAPFlags", "groupQUSel", "groupVZSel" - New installation groups
-
- This function is called at startup and whenever the target volume is
- changed.
- ******************************************************************************/
- {
- long feature;
-
- if (Gestalt(gestaltQuickdrawVersion, &feature) != noErr)
- { /* Gestalt could not return Quickdraw version - force abort later */
- gestaltFailed = true;
- return;
- }
- if (feature < gestalt32BitQD12)
- { /* Version is lower than 1.2 - enable installation group "P" */
- parms->groupAPFlags |= groupPMask;
- }
- else
- { /* Version is 1.2 or higher - disable installation group "P" */
- parms->groupAPFlags &= ~groupPMask;
- }
- }
-
-
- /*****************************************************************************/
- void BeginInstallFunction(void)
- /******************************************************************************
- Input parameters:
- "targetVRefNum" - Volume reference number of target volume
- "groupAPFlags", "groupQUSel", "groupVZSel" - Groups currently selected
- for installation
- Returns:
- "result" - Hook result code
-
- This function is called when the install button is clicked to begin
- installing files.
- ******************************************************************************/
- {
- long feature;
-
- /* Abort if target machine is not running system 6.0.5 or newer */
- if (Gestalt(gestaltSystemVersion, &feature) != noErr)
- { /* Gestalt could not return system version - force abort */
- gestaltFailed = true;
- }
- if (gestaltFailed || (feature < 0x0605))
- { /* Newer system required - display alert then force installer to abort */
- StopAlert(sysRequiredAlrt, NULL);
- parms->result = siHookAbort;
- }
- }
-